﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AmuTools;
using app.Api;
using app.Models;

namespace app.Controllers
{
    public class ViewController : Controller
    {
        public ActionResult Index(string view_name)
        {
            //if (!G.DB.TestDatabaseExists()) new ApiDatabase(this).Do("init");// return View("../Error/start");
            if (!G.IsStarted)
            {
                G.CreateDatabase(this, new ApiDatabase(this).storedprocedures_path);
                G.StartApp();
            }
            if (view_name != "admin" && FreeValue.GetValue("website.is_maintain") == "1") return View("../Error/maintain");
            if (view_name == "browser_support") return View("../Error/browser_support");
            return View(view_name);
        }
    }
}